<?php
namespace app\demo\controller;

use think\Db;
use yunj\Controller;

class MarkdownDemo extends Controller {

    public function index(){
        $builder=YF('article')
            ->tab(['base'=>'基础'])
            ->field(function ($tab){
                $field=[
                    "title"=>[
                        'title'=>'标题',
                        'type'=>'text',
                        'verify'=>'require',
                    ],
                    "content"=>[
                        'title'=>'内容',
                        'type'=>'markdown',
                        "mode_config"=>[
                            "editormd"=>[
                                "height"=>500,
                                "watch"=>true
                            ]
                        ],
                        'verify'=>'require',
                    ],
                ];
                return $field;
            })
            ->button(['reset','submit'])
            ->submit(function ($data,$tab_data){
                return error_json("努力开发中...");
            });
        $builder->assign($this);
        return $this->fetch();
    }

}